Stochastic adaptive-service level agreement-based energy management model for smart grid and prosumers

The growing issue of demand-supply management between the prosumers and the local energy market requires an efficient and reliable energy management model. The microlayers, such as prosumers, energy districts, and macro players, namely retail dealers and wholesale dealers play a pivotal role in achieving mutual benefits. The stochastic nature of renewable energy generation in energy districts requires an effective model that can contemplate all stochastic complexities. Therefore, this paper proposes a mutual trade model between energy districts and smart grid to authorize the prosumers for mutual energy transactions under the stochastic adaptive-service level agreement. Moreover, multiple smart contacts are developed between the stakeholders to design adaptability and stochastic behavior of wind speed and solar irradiance. The real-time adaptations of the stochastic adaptive-service level agreement are based on technical beneficial feasibility and achieved through stochastic and adaptive functions. The optimized solution based on a genetic algorithm is proposed for the energy cost and energy surplus of prosumers and output parameters of the mutual trade model (grid revenue). In the context of mutual benefits associated with balanced demand and supply, the economic load dispatch and simplex method maximization are used for optimized demand-supply energy management. Moreover, the effectiveness of the proposed adaptive and stochastic mutual trade model is validated through simulation and statistical analysis.


Introduction
The energy demand is growing exponentially while fossil fuels are becoming unpopular, and therefore, there is a need to increase the penetration of renewable energy resources in the existing power network along with a better and smarter energy management solution. The International Renewable Energy Agency reported that both government and public partnerships are competitiveness, and prosumer participation. The mutual interactions between smart grid and renewable energy districts using demand response programs were discussed and comprehensively reviewed [21,22] to ensure the participation of distributed end-users. A scenario-based algorithm is used for dealing with the intermittency of wind and solar energy in a combined power system resulting in reduced system cost and minimized environmental pollution [23]. The concept of energy coalition using cooperative game theory in which prosumers operation is enhanced by reducing the overall coalition cost through collaboration between the owners of the energy storage system is presented [24]. Further, the Game theory is organized to reward the outperforming players. The above-mentioned techniques provide a cost-effective solution for mutual energy trading between the Energy Districts (eDs) and smart grids and enhance the prosumer contribution to developing prosumer-based microgrids into modern, controllable, self-healing, and resilient smart grids. However, these works lack in providing (i) multiple Smart Contracts (SCs) based Stochastic and Adaptive SLA (SA-SLA) with multiple RoC and RoD and (ii) demand-supply optimized management using the simplex method and Economic Load Dispatch (ELD).
The key contributions of this paper are given as: • The development and analysis of a prosumer-based energy management model for mutual energy trading between the eDs (wind and solar) and smart grid. The mutual energy trading between multiple eDs increases energy sharing to reduce the peak energy demand.
• The development of a new SCs-based SA-SLA technique with multiple convergences and divergence regions. The new SA-SLA technique can incorporate prosumer energy generation based on stochastic source parameters, such as solar irradiance and wind speed. The stochasticity of source parameters creates multiple ranges of prosumer energy surplus.
• The validation of prosumer energy cost and grid revenue using Genetic Algorithm, when multiple eDs are interfaced with the smart grid considering Real-Time Pricing (RTP) and Day-ahead (DaH) pricing.
• The development and validation of SA-SLA employing multiple SCs-based smart SLAs. Further, the demand-supply optimized management is achieved using the Simplex method and ELD.
The organization of the paper is as follows. Section II discusses the renewable eDs mutual trade model incorporating environmental shifts and DRPs. Section III presents the layers and attributes of the SA-SLA. A robust optimization model for PES, prosumer energy cost, and grid revenue are discussed in Section IV. The performance evaluation including data analysis, seasonal variations, smart SLAs with multiple RoC, and RoD are provided in Section V. Section VI concludes the paper with major findings of work.

System model
The SA-SLA-based MTM between renewable energy generation-based eDs (wind and solar) and utility is presented in this section. MTM is a stochastic adaptive model with a bidirectional energy management capability to incorporate various price-based incentives like RTP and DaH pricing. MTM provides an effect on the energy consumption pattern of prosumers considering stochastic weather parameters including dry bulb temperature, dew point, wind speed, and cloud cover. The development of smart grid technologies focuses on introducing a mechanism that can automatically balance energy demand and energy supply by varying desired set points. In this regard, an effective solution to the prominent issue of balancing energy demand supply is presented [25] using a simplex method and ELD. Price-based incentivization of prosumers and demand-side management are key factors to overcome the issue. The demand-side management ensures pertinent benefits like (i) reducing peak hour demand, (b) consumer energy cost reduction, (c) load profile improvement, and (d) best utilization of renewable energy sources [26]. Keeping in view the stochasticity of source parameters, prosumer interrelation, and community-based relations, Stochastic Adaptive Functions (SAFs) of prosumer-generated energy are included in the MTM to model and design the stochastic behavior of eDs under SA-SLA [19].
The aggregator plays an important role in enhancing the positive behavior of players [20]. A central control party called Coalition Manager (CM) that regulates the behavior of stakeholders is included in MTM. The role of CM is depicted in Fig 1. SCs are developed between stakeholders under the authority of CM. CM is responsible for updating stakeholders on the upcoming weather conditions, energy demands, energy export, energy import, and electricity tariff of energy import and export (nominal, DaH, or RTP). The CM rewards outperforming stakeholders using game theory [24]. Further, CM is responsible to incentivize outperforming players and penalize stakeholders for violating SA-SLA. Some special energy transactions in the form of import or export offered by the service provider are also communicated to prosumers via CM with details of incentives. Prosumer energy import and export are presented in

Environmental shifts
Environmental dynamics vary quantitatively throughout the year. A reasonable climate variation occurred around the year that changed the energy demand of buildings [27]. Environmental shifts pose a pertinent impact on the energy consumption of prosumers. This paper presents a season-wise analysis of energy consumption as the performance of renewable energy generation (PV arrays and wind turbines), is affected by weather parametric variations and climatic drifts. The energy efficiency of renewable energy generation can be increased using proper weather forecasting techniques [28]. Spring, summer, and winter seasons are considered in this paper to analyze the prosumer energy cost (PEC), prosumer energy surplus (PES), and grid revenue (GR).

Demand response programs (DRPs)
DRPs are playing a vital role in the energy management system of the smart grid [22]. The operational costs of microgrids with distributed renewable energy sources can be reduced to a large extent by the participation of DRPs. DRPs can be categorized as time-based or different incentive-based. In DRPs, end users are encouraged to reduce their energy demands during peak hours and accordingly receive a reward based on the types of DRPs. In this paper, the Price based DRPs (i.e., RTP and DaH pricing schemes) are considered and a comparative analysis is provided. CM playing the role of aggregator decides a pricing scheme and communicates to the stakeholders accordingly [29].

Stochastic adaptive-service level agreement
SLA is a formal contract between the service provider (smart grid) and prosumers using predefined service standards. The service responsibility, service quality, service reliability, service response time, performance, and security monitoring aspects are mainly covered in SLA. SLA with a new paradigm of active services, transform passive consumers into technology-enabled active players performing as prosumers. Multiple SCs based on the stochastic nature of RES are developed between stakeholders. Utility and eDs associated with adaptations of SA-SLA play a stakeholder role. Maintaining a balance between energy supply and energy demand is necessary to get socio-economic benefits [2]. The proposed SA-SLA with bi-directional communication, real-time monitoring, service security, and multiple contracts assures a balance between energy demand and energy supply. CM regulates the actions of stakeholders by enforcing their energy activities under SA-SLA by specifying typical rewards and penalties as mentioned in (6). The typical block diagram of SA-SLA is shown in Fig 2. Layers play an important role in appropriately regulating the performance of emergent distribution links [2]. The detail of the three layers used in SA-SLA is as follows. Layer one with active agents, players, and vendors consists of multiple SCs, logic, a set of rules, constraints, and service descriptions. The expectations and responsibilities of stakeholders are also defined in layer one. The stakeholders use layer one in the first phase to communicate with the subsequent layers. Considering various SCs and rules, layer one converts stakeholder's information into a readable form and sends the gathered information to layer two for further processing. Layer two uses directions from CM.
The function of layer two, following the CM direction, is to make decisions based on information prearranged by layer one. A set of If-then rules are involved to evaluate information. After sorting information, layer two, by using if-else commands check the validity of information and sends the decision to both CM and layer three. Layer three is the most trusted and important layer of SA-SLA because CM and stakeholders are directly linked using bidirectional communication. Service security, response time, energy management, and performance of stakeholders are key parameters of layer three. The function of layer three, having instant information of stakeholders, is to send requests of stakeholders to CM for final approval and circulate CM decision for kind information of stakeholders.
The key characteristics of SA-SLA are described as: Stochastic Adaptive Functions (SAFs): Wind and solar energies depend on stochastic environmental parameters (wind speed and solar irradiance) and exhibit highly random behavior. Thus, to capture these energies, it is vital to represent them with some type of functions that approximately follow the same pattern as they do. The Gaussian distribution function is incorporated to capture the energy generated by a wind turbine (WT) and PV arrays.
Smart Contracts (SCs): The contract in which energy import and export prices are independent of PES is known as fix contract. Whatever the PES is, a fixed contract reflects no influence on energy import and export prices and gives rise to a fixed SLA. SCs are dynamic contracts linked with PES. SCs define three different ranges of PES, such as PES from 10%-30%, 31%-60%, and 61%-100%. Contracts are smart in the sense that different PES ranges develop multiple SCs, for example, SC 1 , SC 2 , or SC 3 . SCs incorporating different PES ranges are defined as: where E S is prosumer energy surplus, while SC 1 , SC 2 , and SC 3 are smart contracts 1, 2, and 3 respectively.
Adaptations: Parametric variations, stochastic patterns, SAFs, domains, ranges, and a set of rules are defined for energy balance adaptations. Stochastic and adaptive environmental parameters with stochastic and adaptive domains and ranges of SAFs stochastically change PES and create mismatches between prosumer energy supply and energy demand (of prosumers or utility). The SA-SLA develops a set of SCs for stochastic energy supply conditions. SCs with different ranges of PES are associated with different prosumer energy import and export prices and result in different PEC with less PEC for more PES. In this manner, each SC creates a specific RoC and RoD for PES and according to PEC.
Prosumer Energy Demand: Prosumer energy demand is associated with environmental drifts that greatly influence the energy demand of consumers [12]. The proposed SA-SLA incorporating SAFs adapt these variations caused by stochastic environmental parameters. So, the energy demand of prosumer varies, and variation of stochastic environmental parameters is dealt with SAFs of SA-SLA.
Utility Loading: Grid is considered to export energy to or import energy from eDs prosumers. Utility loading conditions could be lightly loaded, mediumly loaded, heavily loaded, or in an emergency condition.
Convergent and Divergent Contractual Limits: Depending upon the stochasticity of wind speed and solar irradiance parameters, the SAFs result in different ranges of prosumers generated energy. Multiple ranges of prosumers generated energy results in different PES ranges and assisted in the development of SCs. As Gaussian distribution is considered to present the random behavior of prosumer-generated energy, the area under the probability density curves of SAFs is taken as a region of interest in our proposed SA-SLA. In the outer 5% area, the Probability Density Function (PDF) possesses a very small value in the upper portion while the available energy is too little to meet the energy demand of the prosumer in the lower portion. So, for the proposed SA-SLA, the middle 95% area under the PDF curve is considered RoC while RoD refers to the outer 5% area of SA-SLA.
Prosumer Mode: Whenever the Energy produced by an ED is more than the energy demand, the ED will be able to export the extra energy to Utility under the supervision of CM and this surplus energy is referred to as PES.
ðEnergy SurplusÞ ) ððE eDs Þ generation > ðE eDs Þ demand Þ: ð2Þ The dependence of PES on Gaussian distributed prosumers generated energy distributes PES in a gaussian manner whenever the ED is in Prosumer mode of operation.
Consumer Mode: Whenever the energy produced by ED is not enough to meet their load, the ED will import energy from utility to meet energy demand and known as PEC.
ðEnergy CostÞ ) In the consumer mode of operation, the increase in energy generation of ED will decrease energy costs and vice versa. PEC follows inverse relation to ED-generated energy and different PEC will result in multiple SLAs between stakeholders. The smart grid export energy to ED on RTP or DaH pricing.
Utility Revenue: The involvement of a prosumer in the smart grid provides benefits to both the prosumer and the smart grid. The benefits-to-cost ratio is the key parameter to determine the utility benefits with corresponding investment. The energy is directly exported by the grid to various consumers and the energy first imported from eDs is at a nominal rate and then exported to the consumer at RTP or DaH price to generate GR.
Utility Cost: Utility pays prosumers at a nominal price rate for how much energy they export to the utility. So, prosumer energy export to the utility will be considered as a utility cost.
Utility Benefit: Exported energy to consumers at RTP or DaH price. Prosumers pay the utility at RTP and DaH price for how much energy they import from the utility. So, prosumer energy import from the utility will be considered as a utility benefit.
Maximizing Surplus: Considering the different costs of each ED, the simplex optimization method is used to maximize the surplus with decreased cost of eDs.
Utility Energy Demand Management: demand-supply optimized management optimally utilizes energy sources and increases the GR. To satisfy utility energy demand, the simplex method and ELD are proposed in SA-SLA.
Rewards and Penalties: The rewards are associated with the beneficial action and fulfillment of the contract and violation of commitments lead to penalizing the violating body (stakeholder). Amazon EC2 criterion-based rewards and penalties are considered. 10% of the contracted amount will be paid by the penalized body for delay of less than or equal to 1% of total execution time. For the execution time delay of more than 1%, the penalty increases from 10% to 30% of the contracted amount.

Robust Optimization Model (ROM)
SAFs play an important role in ROM to model the variation encountered by highly stochastic wind speed and solar irradiance. The ROM uses SAFs to provide the best possible results based on stochastic source parameters. Stochastic source parameters result in different PES and PEC ranges. Susceptible convergence and divergence limits of SLA are prone to stochastic ranges of PEC and PES. SA-SLA adapts discrepancies of PES and PEC by developing multiple SCs and introduces new beneficial SLA in terms of convergent and divergent limits.

Gaussian distribution functions
Environmental parameters (solar irradiance and wind speed) are stochastic. SA-SLA incorporates SAFs of prosumer-generated energy in response to stochastic parameters (solar irradiance and wind speed). Based on these stochastic parameters, the output energy from WT and PV array approximately follows the Gaussian distribution [30]. The Gaussian distribution function of energy generated is defined as follows: where a ¼ 1 ffi ffi ffi ffi ffi ffi ffi represents mean variable length of generated energy, σ E represents the standard deviation of generated energy, and μ E represents the mean value of generated energy. In probability theory and statistics, a collection of random variables is Independent and Identically Distributed (i.i.d) if they are mutually independent and each random variable in a collection follows the same probability distribution as its counterparts. As prosumer energy solely depends on independently stochastic source parameters, the random variables associated with prosumer generated energy have i.i.d values. Random vector associated with prosumer generated energy is expressed as follows: where E t 1 ; E t 2 ; . . . ; E t k are gaussian i.i.d values of prosumer generated energy in the time interval t 1 , t 2 . . .,t k . Random variables of random vector exhibit i.i.d values. As each component of the random vector exhibits univariate gaussian distribution, the random vector itself exhibits a multivariate gaussian distribution with k-dimension. A linear combination of random vector components is written as: For random variable Y = d T Z and any constant vector d2R k , random vector follows the multivariate gaussian distribution. The generalized expressions for output power and energy from PV arrays and WT are given in the following subsections.

Stochastic wind models
The ED1 and ED2 are wind energy districts. The output power and energy generated by WT are defined as: 8 > > > < > > > : where G w and G w r represent the actual output power and rated output power of WT respectively, v denotes the actual wind speed, v i denotes the cut-in wind speed, v 0 denotes the cut-out wind speed, v r denotes the range of rated wind speed, T w denotes the time of operation of WT, and E w denotes the actual energy generated by WT in time T w .

Stochastic solar models
The ED3 is solar ED. Solar PV arrays are employed to generate electrical power. The output power and energy from the PV array, which is stochastic due to varying solar irradiance [31] is defined as: Where G is the annual averaged solar irradiance received on a tilted axis (in kW/m 2 ), PR represents the performance ratio of the PV module, r denotes the solar array yields (in %), A is the PV array's total area, P act represents the actual output power of the PV module, T PV represents the time of operation of the PV array and E PV represents the actual output energy of the PV array.

Prosumer energy surplus
The prosumer energy generation and energy demand fluctuations greatly influenced the PEC, GR, and PES of the smart grid. PES refers to the extra amount of energy that exceeded the energy demand of the prosumer. The bidirectional energy flow between smart grids and prosumers enables prosumers to export the extra energy to utility with multiple SCs under the SA-SLA framework. The PES is maximized while minimizing the PEC. The optimization problem formulation of PES of j th prosumer is expressed as: PES of prosumers is in the range of minimum energy surplus to maximum energy surplus defined as: where ðE h ED Þ gen;j represents the actual hourly energy generation of j th ED, ðE h ED Þ dem;j denotes the actual hourly energy demand of j th ED, (E ED,max ) dem,j , (E ED,mean ) dem,j and (E ED,min ) dem,j represents the maximum, mean, and minimum energy demand of j th ED respectively, (E ED,r ) gen,j , (E ED,max ) gen,j , (E ED,mean ) gen,j and (E ED,min ) gen,j represents the rated, maximum, mean, and minimum energy generation of j th ED respectively, (E ED ) s,j is the surplus energy of j th ED, and (E ED, min ) s,j , (E ED,mean ) s,j and (E ED,max ) s,j are the minimum, mean, and maximum energy surplus of j th ED.

Prosumer energy cost
The energy generated by the prosumer is usually less than the prosumer energy demand because of the stochastic nature of source parameters. Whenever the prosumer energy generation is not enough to meet the prosumer energy demand, additional energy is imported from the utility that incurs a cost on the prosumer called PEC. Prosumer utilizes utility energy based on RTP or DaH pricing schemes as updated by CM. The optimization problem formulation of PEC of j th prosumer is expressed as: where, P h RTP and P h DaH represents the RTP and DaH hourly pricing, (E ED ) c,j represents the actual energy cost of j th ED while (E ED,min ) c,j , (E ED,mean ) c,j and (E ED,max ) c,j represents the minimum, mean, and maximum energy cost of j th ED respectively.

Grid revenue
The smart grid is facilitating the prosumer to increase their energy generation using renewable energy sources. The prosumer bidirectional energy flow between utility and prosumers is beneficial for all prosumers, utility, and the community. GR is maximized in the proposed SA-SLA based on RTP and DaH pricing schemes as decided by CM. The robust optimization problem formulation of the GR along with physical constraints is formulated as: where P h n represents the nominal price for ED energy export, E h u is the hourly energy import from utility while E h u;min ; E h u;mean , and E h u;max denotes the hourly minimum, mean, and maximum energy import from utility respectively. P h n;max ; P h n;mean and P h n;min represents the hourly maximum, mean, and minimum nominal price rate respectively. GR is the actual GR of the smart grid while GR min , GR mean and GR max represents the minimum, mean, and maximum GR of the smart grid, respectively.

PES maximization using the simplex method
The PES of eDs is utilized to meet stochastic utility energy demand. The simplex method is used to maximize PES with stochastic utility energy satisfaction. Prosumer's energy generation is considered daily in which each ED operates 24 hours of the day to meet stochastic energy demand. Each ED has gaussian i.i.d power generation and surplus P h s;1 ; P h s;2 ; P h s;3 with its capital and maintenance cost. C ED1 , C ED2 , and C ED3 are a total associated cost of ED1, ED2, and ED3 and T 1 ; T 2 ; T 3 denote the time of operation of ED1, ED2, and ED3 respectively. PES is maximized while minimizing PEC and this maximized PES is utilized to meet utility energy demand. The problem formulation is expressed as: s.t.
where C EDt is the total cost associated with all eDs.

Genetic Algorithm (GA) optimization
GA is an evolutionary algorithm for optimizing both constrained and unconstrained optimization problems. GA incorporates functions, namely objective function, fitness function, and genetic operators, such as mutation operator, crossover operator, and reproduction operator. The mutation is the flopping of randomly selected bits with a small mutation probability m while the crossover is the main genetic operator usually associated with a higher probability c . Fitness functions are formulated as objective functions and represented as F S , F C , & F GR for PES, PEC, and GR respectively. Genetic operators are applied to the old solutions and each new iteration, based on the old solution results in a new optimal point. The layout of a Genetic Algorithm for MTM is presented as:

Demand-supply management using the simplex method and ELD
In a smart grid, the energy balance state is maintained by mutual coordination of eDs prosumers and utility through bidirectional energy and information flow. For this purpose, the simplex method maximization and the problem of ELD are proposed for eDs that ensure a balance between utility energy demand and prosumer energy supply. The simplex method maximizes the PES and selects the best possible combination (ratio) of the eDs operating time to meet utility energy demand with minimized eDs operating cost. The ELD calculates the eDs energy surplus with the corresponding eDs total operating cost. The objective is to determine whether PES is enough to meet utility energy demand with minimized eDs operating cost and extra energy (if available) after meeting the utility energy demand. The following are algorithms 2 and 3, which are presented for optimal utility energy demand management. The SCs-based SA-SLA algorithm is presented as: ELD is a technique to determine the optimal output power of multiple simultaneously running generating stations to satisfy stochastic energy demand with minimum cost. Fossil fuelbased generating stations are considered in ELD with several generating units in each station. In such types of generating stations, fuel is the major factor that contributes to the operating cost of generating stations. Fuel consumption varies in direct proportion to the power delivered by generating stations. Thus, to minimize the overall operating cost of several generating stations, it is demanding to optimally determine the output power of each generating station necessary to fulfill stochastic power demand.
For eDs with renewable energy generation facilities, the stochastic natural resources (wind speed, solar irradiance) are used as fuel. So, renewable-based eDs have only maintenance costs associated with them. Their operating (maintenance) cost remains the same irrespective of whether minimum or full rated power is supplied. Therefore, the output power reduction of renewable-based eDs may increase the fuel consumption leading to a high cost of generation. Therefore, there is an emergent need to model ELD for stochastic renewable-based eDs to (a) optimally determine output power for utility energy demand satisfaction and (b) the extra output power after demand fulfillment that can be utilized for any other purpose, such as storing in rechargeable batteries or supply to neighboring prosumer. So, eDs will avail extra advantage of utilizing this stored energy at the time of energy shortage. For a total of n different stochastic renewable-based eDs, the ED set N is defined as: Each ED constitutes a unique stochastic power surplus P EDj . The total stochastic power surplus of eDs at a specified instant will be the sum of their stochastic output power. Total stochastic energy surplus eDs at a specified instant will be the sum of their stochastic output energies defined as: where ðE ED Þ s1 ; ðE ED Þ s2 ; ðE ED Þ s3 ; . . . ; ðE ED Þ sn are the energy surplus of eDs from 1 to n and depend on stochastic environmental parameters. The total operating (maintenance) cost of eDs is defined as: where C ED1 ; C ED2 ; C ED3 ; . . . . . . ::; C EDn refers to operating costs of eDs from 1 to n corresponding to the power surplus of ðP ED Þ s1 ; ðP ED Þ s2 ; ðP ED Þ s3 ; . . . . . . ::; ðP ED Þ sn of n th ED, respectively. The utility energy demand is sinusoidally distributed over the time horizon to reduce complexity and is defined as: where A is the mean utility energy demand. In this paper, three renewable-based eDs are considered for stochastic energy generation. The first two eDs use wind turbines for energy generation while the energy is produced by PV arrays in the third ED. The power surplus of eDs will between the minimum and maximum limits are expressed as: ðP ED Þ s2;min ≼ðP ED Þ s2 ≼ðP ED Þ s2;max ; ð43Þ The overall cost function of the eDs is defined as: where, Q ED,jj is the quadratic scaling factor of j th ED. The problem is to find the portion of the power delivered by each ED that is necessary to meet utility energy demand with minimum eD operating costs. Optimization problem formulation of ELD for stochastic renewable-based eDs is formulated as: where, C EDj,t is the total cost of j th ED while (PED)sj,min (P ED ) sj,min and (P ED ) sj,max are minimum and maximum PES of j th eD. The Langrangian associated with C EDj,t is defined as: where L represents Langrangian of total PES of all three eDs, is inequality constraints of (P ED ) s used in (47) and (50), λ is the constant of multiplication for inequality constraints, is the equality constraints of (P ED ) s and P U used in (48) and (49), while μ is the constant of multiplication for equality constraints. Stochastic environmental parameters (wind speed, solar irradiance) vary the PES of eDs between their minimum energy generation and maximum energy supply capacities. For PES, more than utility energy demand, the value of lambda is updated iteratively until the balance is achieved between PES and utility energy demand except for losses. The PES at this moment is called balanced PES. For PES, less than utility energy demand, the prosumer's energy demand should decrease until the power balanced criterion satisfies defined as: 5 Performance evaluation

Data analytics
Hourly data gathered from trustful sources [32] is considered for one year for three eDs located at Brownsville and Copano Bay Texas US. For day-wise simulations, the hourly available data is averaged for each day of the year. As the source parameters like wind speed and solar irradiance are stochastic and random, the considered data is almost aperiodic type. Seasonal data is also considered, such as winter, summer, and spring. Copano Bay has a Longitude of -97.0 and a Latitude of 28.1. Brownsville has Latitude and Longitude coordinated at 25.9 and -97.5 respectively. We considered WT installation at Copano Bay and solar PV panel installation at Brownsville due to important reasons like (a) having reasonable wind speed ranging from 3.7 m/s to 17.5 m/s enabling Copano Bay to produce enough energy generation and (b) Brownsville has significant solar irradiance to produce massive solar energy.

Seasonal variations
Prosumer's energy consumption patterns and RES parameters show reliance on seasons of the year [33]. For better understanding, it is imperative to clarify the hitches of different seasons [34]. In this context, this paper presents the season-wise analysis of output parameters, such as PES, PEC, and GR. Moreover, a comparative analysis of both optimized and unoptimized results is provided.

Summer season.
The summer season starts from 'June to September at Brownsville and Copano Bay Texas US. The month of June is selected from the summer season for analyzing the PEC, GR, and PES. In summer, maximum wind speed is observed resulting in the highest wind energy production in ED1 and ED2, compared to other seasons. Further, most summer days are sunny resulting in increased solar energy production in ED3. The hotness of summer compels prosumers to switch on the cooling devices for their comfort resulting in peak load, compared to other seasons. So, peak load is recorded in summer apart from maximum energy production resulting in maximum and minimum PEC and PES respectively.

PLOS ONE
SA-SLA on 26 th June for PES. The GR generated by SA-SLA is presented in Fig 8. The selfhealing smart grid with the stochastic adaptive rate of convergence and minimum and maximum GR on 26 th and 15 th June results in fast and slow convergence respectively.

Winter season.
The Winter season starts in October and remains till the end of February at Brownsville and Copano Bay Texas US. The month of October is selected from the winter season for analyzing the PEC, GR, and PES. In the winter season, most of the days are cloudy and windy. So, reasonable wind energy with less solar energy generation (due to reduced solar irradiance) is possible. In the winter season, prosumer uses more heating devices, compared to other seasons resulting in peak load. Due to less solar energy production, the ED3 with PV panels imports more energy from the smart grid resulting in the highest PEC with slow SA-SLA convergence.

Demand-supply optimized management
The proposed SA-SLA using the simplex method and ELD, guarantee a balance between energy supply and energy demand. The matched energy supply and energy demand increase the convergence rate of SA-SLA and GR of the smart grid. The simplex method and ELD are the two prominent techniques employed to concisely manage the energies. Utility energy demand and PES management using the simplex method and ELD are shown in Figs 12 and 13 respectively. The percentage increase in PES using ELD is 11.76 percent, compared to the simplex method. The balance between energy demand and energy supply is achieved with the advantage of extra surplus energy that can be stored or utilized for any other purpose. The

PLOS ONE
Stochastic adaptive-service level agreement-based energy management model for smart grid and prosumers comparison shows that the ELD technique outperforms the simplex method in terms of demand-supply optimized management.

PLOS ONE
PDF curve is considered the RoC of SA-SLA while the remaining 5% outer area is the RoD SA-SLA.

Multiple smart SLAs
The formal contract between the customer (eDs) and service provider (smart grid) with a set of defined service standards is called SLA. PES and PEC are dependent variables of renewable energy generation (wind and solar). The specific range of PES and PEC is contracted between stakeholders defining the RoC and RoD of a specific SLA. Fixed SLA associate static PES and PEC in the contract. The stochastic source parameters result in different PES, PEC, and GR of  for increased mutual benefits. SLA1, SLA2, and SLA3 have some common RoC, but there exists another region where SLA1 diverges while SLA2 shows convergence, as shown in Figs 14 and 15. Similarly, Figs 15 and 16 depict that for the same region, the SLA2 divergences while SLA3 shows convergences. The proposed SA-SLA shows that the RoD region of SLA1 becomes the RoC of SLA2 and similarly, the RoD region of SLA2 becomes the RoC of SLA3. The RoC and RoD of multiple SLAs may completely interchange or overlap and must possess associated PES and PEC.

Statistical analysis
Box-and-whisker plot (also known as a box plot) plays an important role in describing statistical characteristics of numeric data and is especially useful when multiple data sets are being compared. Visual representation of the box plot develops a sense of five important data characteristics, such as lowest observation, highest observation, lower quartile, upper quartile, and median. Lines outside the box are known as whiskers. Bars at the upper and lower tip of whiskers represent the highest and lowest observations while the median is represented by the line inside a box. Box plot analysis of PEC is provided in Fig 17. The vertical axis denotes prosumers cost (in $/Mwh) while the horizontal axis represents RTP optimized, DaH optimized, and unoptimized categories of prosumer cost for ED1, ED2, and ED3. Fig 17 depicts  Similarly, the box plot analysis of PES for all eDs is provided in Fig 18. The vertical axis of Fig 18 represents energy surplus (in Mwh) while the horizontal axis is labeled with optimized and unoptimized categories of prosumer energy surplus for ED1, ED2, and ED3. Fig 18 shows that optimized results of PES are better for all eDs. Prosumers' participation in the smart grid, not only benefits prosumers but also increase the GR of the smart grid. Fig 19 represents a box plot analysis of GR, similarly to PEC with the only difference that instead of PEC, we consider GR (in $/Mwh) at the vertical axis of Fig 19. Improved results in terms of GR of smart grid with RTP-based optimization and DaH pricing-based optimization can be noticed in Fig  19. Moreover, Fig 19 also reveals that optimization based on DaH pricing generates more GR for the smart grid than optimization based on RTP. Therefore, it is concluded that increased mutual benefits of eDs prosumer and smart grid are associated with DaH pricing.

Tabular analysis
As explained earlier, both RoC and RoD are associated with SA-SLA. It is imperative to develop strong knowledge about the contractual limits of RoC and RoD as they decide whether bidirectional energy flow between stakeholders is beneficial or not. PEC, PES, and GR must remain in the corresponding convergence region for the mutual benefit of stakeholders. RoC and RoD of PES, GR, and PEC for ED1, ED2, and ED3 are tabulated in Table 1 for one month of each season (Mar for spring, June for summer, and October for winter) while an SC-based RoC for multiple smart SLAs of SA-SLA is tabulated in Table 2. From Tables 1 and 2, it is concluded that there are different convergence ranges for different SCs in terms of PEC and PES.

Critical debate
Output power from WT and solar PV array is the function of the stochastic source parameters (wind speed and solar irradiance) and is influenced by the stochasticity of source parameters. In this context, prosumers' generated energy varies at every instant following the current statistic of stochastic source parameters. Variations encountered in prosumers generated energy stochastically change prosumers' energy import and export and result in randomly distributing PES and PEC. Prosumer's energy import and export activities are monitored by CM under the authority of SLA. Fixed SLA is based on a fixed contract between stakeholders and inflexible to the stochasticity of source paraments. In real-time scenarios, large variations are encountered in PES and because of fixed contract-based SLA, most PES occur outside the contractual limits. The purpose of utilizing almost all PES for utility energy management arises a need to design an SLA that may vary contractual limits for mutual benefits of stakeholders depending on available PES. A multiple SCs-based SA-SLA is one of the solutions to overcome the limitations of fixed SLA-based EMMs. SAFs of prosumers generated energy is modeled in SA-SLA that generate gaussian i.i.d values of prosumers generated energy. Gaussian i.i.d values of prosumers generated energy stochastically change PES. As PES can vary from minimum prosumer energy generation to their maximum energy generating capacities, various ranges of PES are defined in SC. As stochastic source parameters change their values, the new SCs are developed in terms of PES as defined in (1). SC1 is responsible to develop SLA1 with high PEC and a small area of convergence as shown in Fig 14. This is because of the reason that minimum PES is associated with SC1. SC2 is liable to develop SLA2 with less PEC and a large area of convergence than SLA1 as shown in Fig 15. The PEC is mostly associated with the bottom portion of the convergence area revealing that the large PES of SC2 decreases PEC to some extent. Similarly, SC3 is liable to develop SLA3 with less PEC and a large area of convergence than SLA2 as shown in Fig 16. As the largest PES is associated with SC3, SLA3 has a wider convergence area. As moving further toward large PES in SLA1, SLA2, and SLA3, the PEC decreases but the difference is: that for the same PES, less PEC is associated with SLA2 and SLA3 than with SLA1 because of their contract. Figs 14-16 that 95% convergence area under the PDF curve of PES associates more PES as the move from SLA1 to SLA3 and 95% convergence area under the PDF curve of PEC associates less PES as the move from SLA1 to SLA3. Table 2 shows the improved statistics of SA-SLA in terms of PES and PEC. The demand-supply optimized management is another important perspective of SA-SLA. As explained earlier, the stochastic parameters change PES in a stochastic manner. The variation in PES disturbs the energy balance of prosumers and utility. In response to stochastic PES, an optimized demand-supply management mechanism using the simplex method and ELD is developed and validated as clear in Figs 12 and 13. Moreover, ED1, ED2, and ED3 cumulatively put a great energy share to reduce the peak energy demand of the smart grid. The purpose of the above discussion is clear that SA-SLA with multiple SCs promotes prosumer participation in smart grid and increases the mutual benefits of stakeholders by developing multiple SLAs.

Conclusions
The penetration of renewable energy generation-based eDs into smart grids transforms the behavior of energy importing consumers (utilities) into active energy managing prosumers. The MTM between eDs and smart grid with multiple SCs increases the gain of both parties and flourishes the structure of the power system. The overall performance of the system is influenced by stochastic parameters and the role played by players, actors, and aggregators. In this paper, the stochastic and adaptive functions of prosumer-generated energy are incorporated due to the stochasticity of source parameters. Further, the new SLAs technique is provided to incorporate multiple ranges of PES. The weather's parametric effects on prosumer energy consumption are modeled. The performance of the purposed SA-SLA is evaluated via a season-wise analysis of the year, namely the summer season, spring season, and winter season. The summer season accompanied by regular wind blowing and clear solar irradiance results in massive energy generation from RES. The analysis of the result shows a maximum PEC reduction (31%) in summer, compared to spring (28%) and winter (25%). Similarly, the PES maximization is recorded at 47% in summer than in spring (40%) and winter (41%). Moreover, the demand-supply optimized management achieved by ELD meets 11.76% more utility energy demand than the simplex method. Multiple contractual limits of smart SLAs result in decreased PEC with increased PES. Thus, multiple SCs-based SA-SLA, by developing multiple SLAs, increases the mutual benefits of stakeholders in terms of PEC, PES, and GR.